import { Injectable } from "@nestjs/common";
import { InjectRepository } from "@nestjs/typeorm";
import { Repository } from "typeorm";

import { GemTpl, GemSku } from "qqlx-core";
import { GemTplGateway, GemSkuGateway } from "qqlx-core";
import { GemTplSchema, GemSkuSchema } from "qqlx-cdk";

import { PgDao } from "../../lib/dao.pg.id";

@Injectable()
export class GemTplDao extends PgDao<GemTpl> {
  constructor(
    @InjectRepository(GemTplSchema)
    readonly repo: Repository<GemTpl>,
  ) {
    super({
      repository: repo,
      relations_name: GemTplGateway.relations,
    });
  }
}

@Injectable()
export class GemSkuDao extends PgDao<GemSku> {
  constructor(
    @InjectRepository(GemSkuSchema)
    readonly repo: Repository<GemSku>,
  ) {
    super({
      repository: repo,
      relations_name: GemSkuGateway.relations,
    });
  }
}
